package aqv

import aqv.testingJava.*

class ApplicationController {

    def index() { }
	
	def test(){
		new JavaCaller().printAString()
		render new JavaCaller().returnAString()
	}
	
	def testMail(){
		
		println "BEGIN --- creating user to send email"
		
		def u = new User(login:'login',password: 'password',
							firstName: 'firstName', lastName:'lastName',
							politicalParty: null, politicalPartyRole: null,
							email: 'alejandro.martinez.carballeda@gmail.com')
		
		println "END   --- creating user to send email"
		try{
			println "BEGIN --- sending email"
			sendMail {
				to u.email
				subject 'Registration Confirmation'
				body view: '/emails/confirmRegistration',
				model: [user: u]
			}
			println "END    --- sending email"
		} catch (Exception e) {
			log.error("LOG -- an error ocurred")
			println "An error ocurred while sending email"
		}
		
		println "END of method"
		
	}
	
	
}
